package Thread2;

public class Demo15 {
    public static void main(String[] args) throws InterruptedException {
        Thread mainThread = Thread.currentThread();
        Thread t = new Thread(()->{
            System.out.println("t 开始等待 main 线程");
            try {
                mainThread.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("t 结束等待 main 线程");
        });

        t.start();

        Thread.sleep(3000);
        System.out.println("main 结束");
    }
}
